﻿#ifndef HOUSEMANAGEEDIT_H
#define HOUSEMANAGEEDIT_H

#include <QWidget>
#include <QLineEdit>
#include "globalvars.h"

namespace Ui {
class HouseManageEdit;
}

class HouseManageEdit : public QWidget
{
    Q_OBJECT
signals:
    void signalSubmitHouseInfo();
    void signalUpdateHouseInfo();

public:
    explicit HouseManageEdit(QWidget *parent = nullptr);
    ~HouseManageEdit();

    void setHouseInfosShow(const HouseInfo& house);
    void setHouseImageShow(int index, const ImageList& imageList);
    void forbidEveryOne();
    void allowEveryOne();

    void setIndex(int index);
    void setState(EditState state);
    void setHotelID(const QString &hotelID);

private slots:
    void on_pb_uploadPic_clicked();
    void on_pb_submit_clicked();
    void on_le_houseType_editingFinished();
    void on_le_houseType_textChanged(const QString &arg1);
    void on_le_area_editingFinished();
    void on_le_area_textChanged(const QString &arg1);

    void on_cb_hotWater_clicked(bool checked);
    void on_cb_bath_clicked(bool checked);
    void on_cb_bathThings_clicked(bool checked);
    void on_cb_hearDrier_clicked(bool checked);

    void on_cb_bedType_currentIndexChanged(const QString &arg1);
    void on_pb_cancel_clicked();

private:
    Ui::HouseManageEdit *ui;
    QLineEdit *m_edit;

    EditState m_state;
    int m_index;
    bool m_haveImage;
    QStringList m_bathroomAcc;
    QStringList m_imagePathList;

    HouseInfo m_house;
    void constructeCondition(bool checked, const QString& text);
};

#endif // HOUSEMANAGEEDIT_H
